home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / gnat1792.zip / gnat179b / t-adainc / a-stwibo.ads < prev    next >
Text File  |  1994-05-19  |  13KB  |  341 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --             A D A . S T R I N G S . W I D E _ B O U N D E D              --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.5 $                              --
  10. --                                                                          --
  11. --           Copyright (c) 1992,1993,1994 NYU, All Rights Reserved          --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
  22. --                                                                          --
  23. ------------------------------------------------------------------------------
  24.  
  25.  
  26. with Ada.Strings.Wide_Maps;
  27.  
  28. package Ada.Strings.Wide_Bounded is
  29.  
  30.    Blank : constant Wide_Character := ' ';
  31.  
  32.    generic
  33.       Max : Positive;    -- Maximum length of a Bounded_Wide_String
  34.  
  35.    package Generic_Bounded_Length is
  36.  
  37.       Max_Length : constant Positive := Max;
  38.  
  39.       type Bounded_Wide_String is private;
  40.  
  41.       Null_Bounded_Wide_String : constant Bounded_Wide_String;
  42.  
  43.       subtype Length_Range is Natural range 0 .. Max_Length;
  44.  
  45.       ------------
  46.       -- Length --
  47.       ------------
  48.  
  49.       function Length (Source : in Bounded_Wide_String) return Length_Range;
  50.  
  51.       -----------------------------------------------------
  52.       -- Conversion, Catenation, and Selection Functions --
  53.       -----------------------------------------------------
  54.  
  55.       function To_Bounded_Wide_String (Source : in Wide_String;
  56.                                   Drop   : in Truncation := Error)
  57.         return Bounded_Wide_String;
  58.  
  59.       function To_Wide_String (Source : in Bounded_Wide_String)
  60.         return Wide_String;
  61.  
  62.       function Append (Left, Right : in Bounded_Wide_String;
  63.                        Drop        : in Truncation  := Error)
  64.          return Bounded_Wide_String;
  65.  
  66.       function Append (Left  : in Bounded_Wide_String;
  67.                        Right : in Wide_String;
  68.                        Drop  : in Truncation := Error)
  69.          return Bounded_Wide_String;
  70.  
  71.       function Append (Left  : in Wide_String;
  72.                        Right : in Bounded_Wide_String;
  73.                        Drop  : in Truncation := Error)
  74.          return Bounded_Wide_String;
  75.  
  76.       function Append (Left  : in Bounded_Wide_String;
  77.                        Right : in Wide_Character;
  78.                        Drop  : in Truncation := Error)
  79.          return Bounded_Wide_String;
  80.  
  81.       function Append (Left  : in Wide_Character;
  82.                        Right : in Bounded_Wide_String;
  83.                        Drop  : in Truncation := Error)
  84.          return Bounded_Wide_String;
  85.  
  86.  
  87.       function "&" (Left, Right : in Bounded_Wide_String)
  88.          return Bounded_Wide_String;
  89.  
  90.       function "&" (Left : in Bounded_Wide_String; Right : in Wide_String)
  91.          return Bounded_Wide_String;
  92.  
  93.       function "&" (Left : in Wide_String; Right : in Bounded_Wide_String)
  94.          return Bounded_Wide_String;
  95.  
  96.       function "&" (Left : in Bounded_Wide_String; Right : in Wide_Character)
  97.          return Bounded_Wide_String;
  98.  
  99.       function "&" (Left : in Wide_Character; Right : in Bounded_Wide_String)
  100.          return Bounded_Wide_String;
  101.  
  102.       function Element (Source : in Bounded_Wide_String;
  103.                         Index  : in Positive)
  104.         return Wide_Character;
  105.  
  106.       procedure Replace_Element
  107.         (Source : in out Bounded_Wide_String;
  108.          Index  : in Positive;
  109.          By     : in Wide_Character);
  110.  
  111.       function Slice (Source : in Bounded_Wide_String;
  112.                       Low    : in Positive;
  113.                       High   : in Natural)
  114.         return Wide_String;
  115.  
  116.       function "="  (Left, Right : in Bounded_Wide_String) return Boolean;
  117.  
  118.       function "<"  (Left, Right : in Bounded_Wide_String) return Boolean;
  119.  
  120.       function "<=" (Left, Right : in Bounded_Wide_String) return Boolean;
  121.  
  122.       function ">"  (Left, Right : in Bounded_Wide_String) return Boolean;
  123.  
  124.       function ">=" (Left, Right : in Bounded_Wide_String) return Boolean;
  125.  
  126.       ----------------------
  127.       -- Search Functions --
  128.       ----------------------
  129.  
  130.       function Index (Source   : in Bounded_Wide_String;
  131.                       Pattern  : in Wide_String;
  132.                       Going    : in Direction := Forward;
  133.                       Mapping  : in Wide_Maps.Wide_Character_Mapping
  134.                                  := Wide_Maps.Identity)
  135.         return Natural;
  136.  
  137.       function Index (Source   : in Bounded_Wide_String;
  138.                       Pattern  : in Wide_String;
  139.                       Going    : in Direction := Forward;
  140.                       Mapping  : in Wide_Maps.Wide_Character_Mapping_Function)
  141.         return Natural;
  142.  
  143.       function Index (Source : in Bounded_Wide_String;
  144.                       Set    : in Wide_Maps.Wide_Character_Set;
  145.                       Test   : in Membership := Inside;
  146.                       Going  : in Direction  := Forward) return Natural;
  147.  
  148.  
  149.       function Index_Non_Blank (Source : in Bounded_Wide_String;
  150.                                 Going  : in Direction := Forward)
  151.         return Natural;
  152.  
  153.       function Count (Source   : in Bounded_Wide_String;
  154.                       Pattern  : in Wide_String;
  155.                       Mapping  : in Wide_Maps.Wide_Character_Mapping
  156.                                    := Wide_Maps.Identity)
  157.         return Natural;
  158.  
  159.       function Count (Source   : in Bounded_Wide_String;
  160.                       Pattern  : in Wide_String;
  161.                       Mapping  : in Wide_Maps.Wide_Character_Mapping_Function)
  162.         return Natural;
  163.  
  164.       function Count (Source   : in Bounded_Wide_String;
  165.                       Set      : in Wide_Maps.Wide_Character_Set)
  166.         return Natural;
  167.  
  168.       procedure Find_Token (Source : in Bounded_Wide_String;
  169.                             Set    : in Wide_Maps.Wide_Character_Set;
  170.                             Test   : in Membership;
  171.                             First  : out Positive;
  172.                             Last   : out Natural);
  173.  
  174.       ------------------------------------
  175.       -- Wide_String Translation Subprograms --
  176.       ------------------------------------
  177.  
  178.       function Translate
  179.         (Source : in Bounded_Wide_String;
  180.          Mapping  : in Wide_Maps.Wide_Character_Mapping)
  181.          return Bounded_Wide_String;
  182.  
  183.       procedure Translate
  184.         (Source : in out Bounded_Wide_String;
  185.          Mapping  : in Wide_Maps.Wide_Character_Mapping);
  186.  
  187.       function Translate
  188.         (Source : in Bounded_Wide_String;
  189.          Mapping  : in Wide_Maps.Wide_Character_Mapping_Function)
  190.          return Bounded_Wide_String;
  191.  
  192.       procedure Translate
  193.         (Source : in out Bounded_Wide_String;
  194.          Mapping  : in Wide_Maps.Wide_Character_Mapping_Function);
  195.  
  196.       ---------------------------------------
  197.       -- Wide_String Transformation Subprograms --
  198.       ---------------------------------------
  199.  
  200.       function Replace_Slice
  201.          (Source   : in Bounded_Wide_String;
  202.           Low      : in Positive;
  203.           High     : in Natural;
  204.           By